function boardItemsView(itemsNo){

	$.ajax({
		url: 'board.spring?action=boarditemsView'/*  + '&boarditemsNo=' + itemsNo */,
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		}
	});

}


function boarditemsaaaa() {
	$.ajax({
		url: 'board.spring?action=boarditemsPreAdd',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});
}


function mypage(memberId) {
	$.ajax({
		url: 'member.spring?action=mypage&memberId=' + memberId,
		method:'post',
		success:function(html) {
			$("#contentDiv" ).css({
			});
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}

	});
}

function memberPreModify(memberId){
	$.ajax({
		url: 'member.spring?action=premodify&memberId=' + memberId,
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}
	});
}


function memberModify() {
	$.ajax({
		url: 'member.spring?action=premodify',
		method:'post',
		success:function(html) {
			console.log(html);
			$("#contentDiv" ).css({
				'display': 'inherit'
			});
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}

	});
}
function albumBBS() {
	$.ajax({
		url: 'board.spring?action=boarditemsImagelist',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});
}
function freeBBS() {
	$.ajax({
		url: 'board.spring?action=boarditemslist',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");
		}
	});
}
function qnaBBS() {
	$.ajax({
		url: 'board.spring?action=boarditemslist',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");
		}
	});
}
function informationPage() {
	$.ajax({
		url: 'informationPage.jsp',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");
		}
	});
}
function memberAdd() {
	$.ajax({
		url: 'member.spring?action=preadd',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");
		}
	});
}

function healthCheckUp(memberId){
	 window.open("member.spring?action=healthCheckUp&memberId=" + memberId,
	         "_blank",
	         "width=420," +
	         " height=500," +
	         " toolbar=no, " +
	         "menubar=no, " +
	         "scrollbars=no," +
	         "resizable=no, " +
	         "copyhistory=no"+
	         "location=no");
}


function checkDiv() {
	$div = $('#healthMain-tab-main');
	console.log($div);

	if($div != null) {
		$("div").detach("#healthMain-tab-main");
		freeBBS();
	}
	else {
		freeBBS();
	}
}

function menuBarReading() {
	$.ajax({
		url: 'schedule.spring?action=foodMain',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});

}

// 모든 음식 페이지
function totalFoodInformation() {
	$.ajax({
		url: 'schedule.spring?action=totalFoodInformation',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(e){
			console.error("실패");
		}

	});

}

/* 음식/영양  섭취 목적 리스트 */
function foodIngestPurposeSelectList(food) {
	$.ajax({
		url:'schedule.spring',
		method:'POST',
		data: { action:'foodIngestPurposeSelectList', foodIngestPurpose:food },
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			console.error("실패");
		}

	});

}

/* 운동 정보 운동 목적 리스트  */
function exercisePurposeSelectList(sport) {
	$.ajax({
		url:'schedule.spring',
		method:'POST',
		data: { action:'exercisePurposeSelectList', exercisePurpose:sport },
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			console.error("실패");
		}

	});
} 


function grouplist() {
	$.ajax({
		url: 'group.spring?action=grouplist',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});
}
function groupPreAdd() {
	$.ajax({
		url: 'group.spring?action=grouplist',
		method:'post',
		data:{AddBtn:'true'},
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});
}

function groupAdd() {
	$.ajax({
		url: 'group.spring',
		method:'post',
		data: $("#groupAddForm").serialize() + '&action=groupadd',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail"); 
		}

	});
}

/*
 * 
 *    건강 관리 기록부 관련 js (ajax)
 * 
 * 
 */
//건강기록부 메인
var array = new Array();
var key = new Array();
var value = new Array();
function healthCareMain() {

	$.ajax({
		url: 'test.spring?action=test',
		method:'post',
		success:function(html, data) {
			$(".parsingPage").html(html);
			if (data != 'success') {
				console.log('실패');
			} else {
				$.ajax({
					url: 'test.spring?action=json',
					method: 'post',
					dataType: 'json',
					success: function (data) {
						console.log(data);
						console.log(typeof data);
						$.each(data, function (index) {
							array = data[index];
							if(typeof array === 'object'){
								for(var i in array){
									if(i == 'foodName'){
										key.push(i);
										value.push(array[i]);
									}
								}
							}
							else {
								alert('Not Object');
							}

						});
					}

				});
			}
		},
		error:function(){
			alert("fail");
		}

	});
}

/* 개인상세정보 */
function privateInformation() {
	$.ajax({
		url: 'member.spring?action=list',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");
		}

	});

}

/* 건강통계 */
function healthGraph() {
	$.ajax({
		url: 'healthChart.jsp',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(e){
			alert("failed");
		}

	});
}    

/*  운동  */
function mySports() {
	$.ajax({
		url: 'mySports.jsp',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}

	});

}
/* 스케줄러 */
function schedular() {
	$.ajax({
		url: 'calendar.jsp',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}

	});

}
/* 내 식단표  */
function myFood() {
	$.ajax({
		url: 'myFood.jsp',
		method:'post',
		success:function(html) {
			$(".parsingPage").html(html);
		},
		error:function(){
			alert("fail");	
		}

	});

}